<?php 
  require(dirname(__FILE__).'/global.php');
  require(ROOT.'/admin/isLogin.php');
  require(ROOT.'/include/xml.class.php'); 
  
  $submit = $_POST['submit'];     
  $xmlPath = ROOT.'/common.xml';
  $xml = new SimpleXMLUtil($xmlPath);
  if(isset($submit))
  {
      $isRewrite = $_POST['isRewrite'];
      $title = $_POST['title'];
      $metaKeywords = $_POST['metaKeywords'];
      $metaDescription = $_POST['metaDescription'];
      $metaOtherInfo = $_POST['metaOtherInfo']; 
                                               
      $xml->setElementValue('Rewrite',$isRewrite);
      $xml->setElementValue('MetaTitle',$title);
      $xml->setElementValue('MetaKeywords',$metaKeywords);
      $xml->setElementValue('MetaDescription',$metaDescription);
      $xml->setElementValue('MetaOther',$metaOtherInfo);  
      $xml->save();
      
      $smarty->assign('tip','更新成功'); 
  }                                 
  $isRewrite = $xml->getElementValue("Rewrite") ? $xml->getElementValue("Rewrite") : 'y';
  $title = $xml->getElementValue("MetaTitle");                                             
  $metaKeywords = $xml->getElementValue("MetaKeywords");
  $metaDescription = $xml->getElementValue("MetaDescription"); 
  $metaOtherInfo = $xml->getElementValue("MetaOther");             
     
  $smarty->assign('isRewrite',$isRewrite); 
  $smarty->assign('title',$title);
  $smarty->assign('metaKeywords',$metaKeywords);
  $smarty->assign('metaDescription',$metaDescription);
  $smarty->assign('metaOtherInfo',$metaOtherInfo);
  $smarty->display('seo.html');
  $db->close();
?>
